// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
#pragma once
#include "IWeatherService.h"
#include "HttpRequestThrottler.h"

namespace Weathr
{
    namespace Web
    {
        // Retrieves weather information from the World Weather Online web service.
        // http://www.worldweatheronline.com/
        class WWOWeatherService : public IWeatherService
        {
        public:
            WWOWeatherService();

            // Updates the weather information associated with the provided Forecast object.
            concurrency::task<void> GetWeatherInfoAsync(Weathr::Forecast^ forecast);

            // Retrieves the name of the service.
            std::wstring GetServiceName() const;

        private:
            // The World Weather Online service limits Free API usage to a certain number of calls per second.
            // This agent helps us throttle calls to fit this limit.
            // NOTE: If you're using the paid service, you can replace the throttler with direct calls to the 
            // web service.
            HttpRequestThrottler m_throttler;
        };
    }
}